package com.example.onlinereadingsystem.demos.web.controller.web;

import com.example.onlinereadingsystem.demos.web.dto.domain.NovelKind;
import com.example.onlinereadingsystem.demos.web.dto.vo.NovelDetailInfoVo;
import com.example.onlinereadingsystem.demos.web.service.KindService;
import com.example.onlinereadingsystem.demos.web.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Description 分类页接口
 * @Author ljm
 * @Date 2024/10/13
 */
@RestController
@RequestMapping("/web/kind")
public class KindController {
    @Autowired
    private KindService kindService;

    /**
     * @auther ljm
     * @create 2024/10/14
     * @describe 获取所有分类
     */
    @GetMapping("/getKindList")
    public Result<List<NovelKind>> getKindList() {
        return kindService.getKindList();
    }

    /**
     * @auther ljm
     * @create 2024/10/14
     * @describe 通过分类id获取书籍信息
     */
    @GetMapping("/getKindDetail/{id}")
    public Result<List<NovelDetailInfoVo>> getKindDetail(@PathVariable String id) {
        return kindService.getKindDetail(id);
    }
}
